package com.zh.view

import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.graphics.Color
import java.time.LocalDateTime


enum class Position {
    LEFT, RIGHT, TOP, BOTTOM
}

enum class TaskStatus {
    CREATED, //新创建（即未开始）
    RUNNING, //传输中
    COMPLETED, //已完成
}

data class FileDataItem(
    val id: String,
    val fileName: String,
    val fileSize: Long,
    val isDir: Boolean,
) : Comparable<FileDataItem> {
    val time: LocalDateTime = LocalDateTime.now()
    var status = mutableStateOf(TaskStatus.CREATED)
    var progressValue = mutableStateOf<Float>(0.0f)


    override fun equals(other: Any?): Boolean {
        if (other == null || other !is FileDataItem) return false
        return this.id == other.id
    }

    override fun compareTo(other: FileDataItem): Int {
        return this.id.compareTo(other.id)
    }
}

class ChatMsg(
    val id: String,
    val message: String,
    val self: Boolean,
    val from: String = ""
) {
    var isFail: Boolean = false
}

// 辅助函数：根据状态获取显示文本
fun formatStatus(status: TaskStatus): String {
    return when (status) {
        TaskStatus.CREATED -> "等待"
        TaskStatus.RUNNING -> "进行中"
        TaskStatus.COMPLETED -> "已完成"
    }
}

// 辅助函数：根据状态获取文本颜色
fun getStatusColor(status: TaskStatus): Color {
    return when (status) {
        TaskStatus.CREATED -> Color(0xFF9E9E9E)  // 柔和灰色
        TaskStatus.RUNNING -> Color(0xFF42A5F5)  // 柔和蓝色（比系统蓝更浅）
        TaskStatus.COMPLETED -> Color(0xFF66BB6A) // 柔和绿色（降低饱和度）
    }
}
